<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ComObjCreate()</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>ComObjCreate() <span class="ver">[AHK_L 53+]</span></h1>
<p>Creates a COM object.</p>
<pre class="Syntax">ComObject := ComObjCreate(CLSID [, IID])</pre>

<h3>Parameters</h3>
<dl>

  <dt>CLSID</dt>
  <dd><p>CLSID or human-readable Prog ID of the COM object to create.</p></dd>

  <dt>IID</dt>
  <dd><p><span class="ver">[v1.0.96.00+]:</span> The identifier of an interface the object supports.</p></dd>

</dl>

<h3>Return Value</h3>
<p>If an error occurs, an empty string is returned.</p>
<p>If an IID is specified, an interface pointer is returned. The script must typically call <a href="ObjAddRef.htm">ObjRelease</a> when it is finished with the pointer.</p>
<p>Otherwise, a wrapper object usable by script is returned. See <a href="../Objects.htm#Usage_Objects">object syntax</a>.</p>

<h3>Related</h3>
<a href="ComObjGet.htm">ComObjGet</a>, <a href="ComObjActive.htm">ComObjActive</a>, <a href="ComObjConnect.htm">ComObjConnect</a>, <a href="ComObjArray.htm">ComObjArray</a>, <a href="ComObjError.htm">ComObjError</a>, <a href="ComObjQuery.htm">ComObjQuery</a>, <a href="http://msdn.microsoft.com/en-us/library/dcw63t7z.aspx">CreateObject (MSDN)</a>

<h3>Examples</h3>
<p>For a constantly growing list of examples, see the following forum topic: <a href="http://www.autohotkey.com/forum/topic61509.html">http://www.autohotkey.com/forum/topic61509.html</a>.</p>
<pre class="NoIndent">
ie := <b>ComObjCreate</b>("InternetExplorer.Application")
ie.Visible := true  <em>; This is known to work incorrectly on IE7.</em>
ie.Navigate("http://ahkscript.org/")
</pre>

</body>
</html>
